package bb

import android.content.Context
import android.content.Intent
import android.graphics.BitmapFactory
import android.os.Bundle
import android.os.PersistableBundle
import android.util.Base64
import androidx.appcompat.app.AppCompatActivity
import com.bumptech.glide.Glide
import com.clean.scanlibrary.bean.CurrencyInfoBean
import oa.lla.cca.databinding.ActivityPicshowLayoutBinding


class CL:AppCompatActivity() {

    private var bind : ActivityPicshowLayoutBinding? = null
    private var oldPic:String = ""
    private val dataBind get() = bind!!
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        bind = ActivityPicshowLayoutBinding.inflate(layoutInflater)
        setContentView(bind!!.root)
        initView()
    }




    companion object{
        const val OLD_PIC:String = "oldPic"
        const val NOW_PIC:String = "nowPic"
        fun intentPicShowActivity(context: Context,oldPic:String,byteArray:ByteArray){
            val intent:Intent = Intent(context,CL::class.java)
            intent.putExtra(OLD_PIC,oldPic)
            intent.putExtra(NOW_PIC,byteArray)
            context.startActivity(intent)
        }

    }

    private fun initView() {
        oldPic = intent.getStringExtra(OLD_PIC).toString()
//        val byteArrayExtra = intent.getByteArrayExtra(NOW_PIC)
        val byteArrayExtra = intent.getStringExtra(NOW_PIC)
//        val bitmap = BitmapFactory.decodeByteArray(byteArrayExtra, 0, byteArrayExtra!!.size)
        Glide.with(this).load(oldPic).into(dataBind.originalPic)
        Glide.with(this).load(byteArrayExtra).into(dataBind.nowPic)
    }

}